package controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import pojo.Item;
import service.ItemService;

@Controller

public class ItemController {

    @Autowired
    private ItemService itemService;

    @RequestMapping("/show/{id}")
    public String findById(@PathVariable("id") int id, Model model){
        Item byId = itemService.findById(id);
        model.addAttribute("item",byId);
        return "item";
    }

}
